home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / Windows / Interfaces / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-03  |  12.5 KB  |  434 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3DViewer.h                                             **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     Viewer Controller Interface File.                         **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **     Copyright (C) 1994-1996 Apple Computer, Inc.  All rights reserved.     **
  10.  **                                                                              **
  11.  **                                                                              **
  12.  *****************************************************************************/
  13.  
  14. #ifndef QD3DViewer_h
  15. #define QD3DViewer_h
  16.  
  17. #include "QD3D.h"
  18. #include "QD3DGroup.h"
  19.  
  20. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  21.  
  22. #include <Events.h>
  23. #include <Types.h>
  24. #include <Windows.h>
  25.  
  26. #if defined(THINK_C) || defined(__SC__)
  27.     #pragma options(!pack_enums, !align_arrays)
  28.     #pragma SC options align=power
  29. #elif defined(__MWERKS__)
  30.     #pragma enumsalwaysint on
  31.     #pragma align_array_members off
  32.     #pragma options align=native
  33. #elif defined(__PPCC__)
  34.     #pragma options align=power
  35. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  36.     #pragma options enum=int
  37. #endif
  38.  
  39. typedef void *TQ3ViewerObject;
  40.  
  41. typedef OSErr (*TQ3ViewerDrawingCallbackMethod)(
  42.         TQ3ViewerObject    theViewer,
  43.         const void *data);
  44.  
  45.  
  46. enum {
  47.  
  48.     kQ3ViewerShowBadge             = 1<<0,
  49.     kQ3ViewerActive                = 1<<1,
  50.     kQ3ViewerControllerVisible    = 1<<2,
  51.     kQ3ViewerDrawFrame            = 1<<3,
  52.     kQ3ViewerDraggingOff        = 1<<4,
  53.     
  54.     kQ3ViewerButtonCamera        = 1<<5,
  55.     kQ3ViewerButtonTruck        = 1<<6,
  56.     kQ3ViewerButtonOrbit        = 1<<7,
  57.     kQ3ViewerButtonZoom            = 1<<8,
  58.     kQ3ViewerButtonDolly        = 1<<9,
  59.     kQ3ViewerButtonReset        = 1<<10,
  60.     
  61.     kQ3ViewerOutputTextMode        = 1<<11,
  62.     kQ3ViewerDragMode            = 1<<12,
  63.  
  64.     kQ3ViewerDrawGrowBox        = 1<<13,
  65.     kQ3ViewerDrawDragBorder        = 1<<14,
  66.  
  67.     kQ3ViewerDraggingInOff        = 1<<15,
  68.     kQ3ViewerDraggingOutOff        = 1<<16,
  69.  
  70.     kQ3ViewerDefault            = 1<<31
  71. };
  72.  
  73. enum {
  74.     kQ3ViewerEmpty    = 0,
  75.     kQ3ViewerHasModel = 1<<0,
  76.     kQ3ViewerHasUndo  = 1<<1
  77. };
  78.  
  79. typedef enum TQ3ViewerCameraView {
  80.     kQ3ViewerCameraRestore,
  81.     kQ3ViewerCameraFit,
  82.     kQ3ViewerCameraFront,
  83.     kQ3ViewerCameraBack,
  84.     kQ3ViewerCameraLeft,
  85.     kQ3ViewerCameraRight,
  86.     kQ3ViewerCameraTop,
  87.     kQ3ViewerCameraBottom
  88. } TQ3ViewerCameraView;
  89.  
  90. enum {
  91.     gestaltQD3DViewer            = 'q3vc',
  92.     gestaltQD3DViewerNotPresent    = 0,
  93.     gestaltQD3DViewerAvailable    = 1
  94. };
  95.  
  96. #ifdef __cplusplus
  97. extern "C" {
  98. #endif    /* __cplusplus */
  99.  
  100. /******************************************************************************
  101.  **                                                                             **
  102.  **        Return viewer version number                                         **
  103.  **                                                                             **
  104.  *****************************************************************************/
  105.  
  106. unsigned long Q3ViewerGetVersion(
  107.     void);
  108.     
  109. /******************************************************************************
  110.  **                                                                             **
  111.  **        Creation and destruction                                             **
  112.  **        Note that this is not a QuickDraw 3D object                             **
  113.  **                                                                             **
  114.  *****************************************************************************/
  115.  
  116. TQ3ViewerObject Q3ViewerNew(
  117.     CGrafPtr        port,
  118.     Rect            *rect,
  119.     unsigned long    flags);
  120.     
  121. OSErr Q3ViewerDispose(
  122.     TQ3ViewerObject theViewer);
  123.  
  124. /******************************************************************************
  125.  **                                                                             **
  126.  **        Functions to attach data to a viewer                                 **
  127.  **                                                                             **
  128.  *****************************************************************************/
  129.  
  130. OSErr Q3ViewerUseFile(
  131.     TQ3ViewerObject    theViewer,
  132.     long            refNum);
  133.     
  134. OSErr Q3ViewerUseData(
  135.     TQ3ViewerObject    theViewer,
  136.     void            *data,
  137.     long            size);
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **        Functions to write data out from the Viewer                             **
  142.  **                                                                             **
  143.  *****************************************************************************/
  144.  
  145. OSErr Q3ViewerWriteFile(
  146.     TQ3ViewerObject    theViewer,
  147.     long            refNum);
  148.     
  149. unsigned long Q3ViewerWriteData(
  150.     TQ3ViewerObject    theViewer,
  151.     void            **data);
  152.  
  153. /******************************************************************************
  154.  **                                                                             **
  155.  **        Use this function to force the Viewer to re-draw                     **
  156.  **                                                                             **
  157.  *****************************************************************************/
  158.  
  159. OSErr Q3ViewerDraw(
  160.     TQ3ViewerObject theViewer);
  161.  
  162. OSErr Q3ViewerDrawContent(
  163.     TQ3ViewerObject theViewer);
  164.  
  165. OSErr Q3ViewerDrawControlStrip(
  166.     TQ3ViewerObject theViewer);
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **        Function used by the Viewer to filter and handle events                 **
  172.  **                                                                             **
  173.  *****************************************************************************/
  174.  
  175. Boolean Q3ViewerEvent(
  176.     TQ3ViewerObject    theViewer,
  177.     EventRecord        *evt);
  178.  
  179. /******************************************************************************
  180.  **                                                                             **
  181.  **        This function returns a PICT of the contents of the                  **
  182.  **        Viewer's window.  The application should dispose the PICT.             **
  183.  **                                                                             **
  184.  *****************************************************************************/
  185.  
  186. PicHandle Q3ViewerGetPict(
  187.     TQ3ViewerObject theViewer);
  188.  
  189. /******************************************************************************
  190.  **                                                                             **
  191.  **        Calls for dealing with Buttons                                         **
  192.  **                                                                             **
  193.  *****************************************************************************/
  194.  
  195. OSErr Q3ViewerGetButtonRect(
  196.     TQ3ViewerObject    theViewer,
  197.     unsigned long    button,
  198.     Rect            *rect);
  199.  
  200. unsigned long Q3ViewerGetCurrentButton(
  201.     TQ3ViewerObject    theViewer);
  202.     
  203. OSErr Q3ViewerSetCurrentButton(
  204.     TQ3ViewerObject    theViewer,
  205.     unsigned long    button);
  206.  
  207. /******************************************************************************
  208.  **                                                                             **
  209.  **        Functions to set/get the group to be displayed by the Viewer.         **
  210.  **                                                                             **
  211.  *****************************************************************************/
  212.  
  213. OSErr Q3ViewerUseGroup(
  214.     TQ3ViewerObject    theViewer,
  215.     TQ3GroupObject    group);
  216.     
  217. TQ3GroupObject Q3ViewerGetGroup(
  218.     TQ3ViewerObject    theViewer);
  219.  
  220. /******************************************************************************
  221.  **                                                                             **
  222.  **        Functions to set/get the color used to clear the window                 **
  223.  **                                                                             **
  224.  *****************************************************************************/
  225.  
  226. OSErr Q3ViewerSetBackgroundColor(
  227.     TQ3ViewerObject    theViewer,
  228.     TQ3ColorARGB    *color);
  229.     
  230. OSErr Q3ViewerGetBackgroundColor(
  231.     TQ3ViewerObject    theViewer,
  232.     TQ3ColorARGB    *color);
  233.  
  234. /******************************************************************************
  235.  **                                                                             **
  236.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  237.  **                                                                             **
  238.  *****************************************************************************/
  239.  
  240. TQ3ViewObject Q3ViewerGetView(
  241.     TQ3ViewerObject    theViewer);
  242.  
  243. OSErr Q3ViewerRestoreView(
  244.     TQ3ViewerObject    theViewer);
  245.  
  246. /******************************************************************************
  247.  **                                                                             **
  248.  **        Calls for setting/getting viewer flags                                 **
  249.  **                                                                             **
  250.  *****************************************************************************/
  251.  
  252. OSErr Q3ViewerSetFlags(
  253.     TQ3ViewerObject    theViewer,
  254.     unsigned long    flags);
  255.     
  256. unsigned long Q3ViewerGetFlags(
  257.     TQ3ViewerObject    theViewer);
  258.  
  259. /******************************************************************************
  260.  **                                                                             **
  261.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  262.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  263.  **        or the current dimensions of the window (if you do a Set).             **
  264.  **                                                                             **
  265.  *****************************************************************************/
  266.  
  267. OSErr Q3ViewerSetBounds(
  268.     TQ3ViewerObject    theViewer,
  269.     Rect            *bounds);
  270.     
  271. OSErr Q3ViewerGetBounds(
  272.     TQ3ViewerObject    theViewer,
  273.     Rect            *bounds);
  274.  
  275. OSErr Q3ViewerSetDimension(
  276.     TQ3ViewerObject    theViewer,
  277.     unsigned long    width,
  278.     unsigned long    height);
  279.  
  280. OSErr Q3ViewerGetDimension(
  281.     TQ3ViewerObject    theViewer,
  282.     unsigned long    *width,
  283.     unsigned long    *height);
  284.  
  285. /* 1.1 */
  286. OSErr Q3ViewerGetMininumDimension(
  287.     TQ3ViewerObject    theViewer,
  288.     unsigned long    *width,
  289.     unsigned long    *height);
  290.  
  291. /******************************************************************************
  292.  **                                                                             **
  293.  **        Port related calls                                                     **
  294.  **                                                                             **
  295.  *****************************************************************************/
  296.  
  297. OSErr Q3ViewerSetPort(
  298.     TQ3ViewerObject    theViewer,
  299.     CGrafPtr        port);
  300.     
  301. CGrafPtr Q3ViewerGetPort(
  302.     TQ3ViewerObject    theViewer);
  303.  
  304. /******************************************************************************
  305.  **                                                                             **
  306.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  307.  **        to change the cursor according to the cursor position/object under     **
  308.  **        the cursor.                                                             **
  309.  **                                                                             **
  310.  *****************************************************************************/
  311.  
  312. Boolean Q3ViewerAdjustCursor(
  313.     TQ3ViewerObject    theViewer,
  314.     Point            *pt);
  315.  
  316. OSErr Q3ViewerCursorChanged(
  317.     TQ3ViewerObject    theViewer);
  318.     
  319. /******************************************************************************
  320.  **                                                                             **
  321.  **        Returns the state of the viewer.  See the constant defined at the     **
  322.  **        top of this file.                                                     **
  323.  **                                                                             **
  324.  *****************************************************************************/
  325.  
  326. unsigned long Q3ViewerGetState(
  327.     TQ3ViewerObject    theViewer);
  328.  
  329. /******************************************************************************
  330.  **                                                                             **
  331.  **        Clipboard utilities                                                     **
  332.  **                                                                             **
  333.  *****************************************************************************/
  334.  
  335. OSErr Q3ViewerClear(
  336.     TQ3ViewerObject    theViewer);
  337.     
  338. OSErr Q3ViewerCut(
  339.     TQ3ViewerObject    theViewer);
  340.     
  341. OSErr Q3ViewerCopy(
  342.     TQ3ViewerObject    theViewer);
  343.     
  344. OSErr Q3ViewerPaste(
  345.     TQ3ViewerObject    theViewer);
  346.  
  347. /******************************************************************************
  348.  **                                                                             **
  349.  **        1.1                                                                     **
  350.  **        New Event Model                                                         **
  351.  **                                                                             **
  352.  *****************************************************************************/
  353.  
  354. Boolean Q3ViewerMouseDown(
  355.     TQ3ViewerObject    theViewer,
  356.     long                x,
  357.     long                y);
  358.  
  359. Boolean Q3ViewerContinueTracking(
  360.     TQ3ViewerObject    theViewer,
  361.     long                x,
  362.     long                y);
  363.  
  364. Boolean Q3ViewerMouseUp(
  365.     TQ3ViewerObject    theViewer,
  366.     long                x,
  367.     long                y);
  368.  
  369. Boolean Q3ViewerHandleKeyEvent(
  370.     TQ3ViewerObject    theViewer,
  371.     EventRecord        *evt);
  372.  
  373. /******************************************************************************
  374.  **                                                                             **
  375.  **        1.1                                                                     **
  376.  **        Drawing CallBack                                                     **
  377.  **                                                                             **
  378.  *****************************************************************************/
  379.  
  380. OSErr Q3ViewerSetDrawingCallbackMethod(
  381.         TQ3ViewerObject                    theViewer,
  382.         TQ3ViewerDrawingCallbackMethod    callbackMethod,
  383.         const void *data);
  384.  
  385. /******************************************************************************
  386.  **                                                                             **
  387.  **        1.1                                                                     **
  388.  **        Undo                                                                  **
  389.  **                                                                             **
  390.  *****************************************************************************/
  391.  
  392. OSErr     Q3ViewerUndo(
  393.             TQ3ViewerObject    theViewer);
  394.         
  395. Boolean Q3ViewerGetUndoString(
  396.             TQ3ViewerObject    theViewer, 
  397.             char             *string,
  398.             unsigned long     *cnt);
  399.  
  400. /******************************************************************************
  401.  **                                                                             **
  402.  **        1.1                                                                     **
  403.  **        New Camera Stuff                                                     **
  404.  **                                                                             **
  405.  *****************************************************************************/
  406.  
  407.  
  408. OSErr Q3ViewerGetCameraCount(
  409.         TQ3ViewerObject    theViewer, 
  410.         unsigned long     *cnt);
  411.  
  412. OSErr Q3ViewerSetCameraByNumber(
  413.         TQ3ViewerObject    theViewer, 
  414.         unsigned long     cameraNo);
  415.  
  416. OSErr Q3ViewerSetCameraByView(
  417.         TQ3ViewerObject        theViewer, 
  418.         TQ3ViewerCameraView viewType);
  419.  
  420. #ifdef __cplusplus
  421. }
  422. #endif    /* __cplusplus */
  423.  
  424. #if defined(__MWERKS__)
  425.     #pragma enumsalwaysint reset
  426. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  427.     #pragma options enum=reset
  428. #endif
  429.  
  430. #endif     /* OS_MACINTOSH */
  431.  
  432. #endif    /* QD3DViewer_h */
  433.  
  434.